package com.acwing.partition4;

import java.io.*;
import java.util.Arrays;

/**
 * @author `RKC`
 * @date 2022/4/2 9:19
 */
public class AC363B城 {

    private static final int N = 100010, M = 1000010;
    private static int[] h = new int[N], e = new int[M], ne = new int[M];
    private static int[] dfn = new int[N], low = new int[N], size = new int[N];
    private static boolean[] cut = new boolean[N];
    private static long[] ans = new long[N];
    private static int n, m, idx = 0, timestamp = 0;

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        String[] ss = reader.readLine().split(" ");
        n = Integer.parseInt(ss[0]);
        m = Integer.parseInt(ss[1]);
        Arrays.fill(h, -1);
        for (int i = 0; i < m; i++) {
            ss = reader.readLine().split(" ");
            int a = Integer.parseInt(ss[0]), b = Integer.parseInt(ss[1]);
            add(a, b);
            add(b, a);
        }
        for (int i = 1; i <= n; i++) {
            if (dfn[i] == 0) tarjan(i, i);
        }
        for (int i = 1; i <= n; i++) writer.write(ans[i] + "\n");
        writer.flush();
    }

    private static void tarjan(int u, int root) {
        dfn[u] = low[u] = ++timestamp;
        size[u] = 1;
        int cnt = 0, sum = 0;
        for (int i = h[u]; i != -1; i = ne[i]) {
            int v = e[i];
            if (dfn[v] == 0) {
                tarjan(v, root);
                size[u] += size[v];
                low[u] = Math.min(low[u], low[v]);
                if (low[v] >= dfn[u]) {
                    cnt++;
                    ans[u] += (long) size[v] * (n - size[v]);
                    sum += size[v];
                    if (u != root || cnt > 1) cut[u] = true;
                }
            } else low[u] = Math.min(low[u], dfn[v]);
        }
        //(n - sum - 1) * (sum + 1)：计算不与当前割点连接的其余点和当前割点能到达的点构成的有效集合
        if (cut[u]) ans[u] += (long) (n - sum - 1) * (sum + 1) + (n - 1);
        else ans[u] = 2L * (n - 1);
    }

    private static void add(int a, int b) {
        e[idx] = b;
        ne[idx] = h[a];
        h[a] = idx++;
    }
}
